# !/bin/bash

ASCEND_HOME_PATH="/usr/local/Ascend/ascend-toolkit/latest"

if grep -q "export ASCEND_HOME_PATH=${ASCEND_HOME_PATH}" ~/.bashrc; then
    echo "ASCEND_HOME_PATH is already set in ~/.bashrc"
else
    echo "export ASCEND_HOME_PATH=${ASCEND_HOME_PATH}" >> ~/.bashrc
    echo "ASCEND_HOME_PATH added to ~/.bashrc"
fi



[ ! -e /home/ma-user/anaconda3/envs/py38 ] && conda create -n py38 python=3.8 -y
source /home/ma-user/anaconda3/bin/activate py38

cd ~/work/code/LLaMA-Factory
pip install -e ".[torch-npu, metrics]" setuptools==59.5.0 deepspeed
export ASCEND_HOME_PATH=/usr/local/Ascend/ascend-toolkit/latest
llamafactory-cli version

[ ! -e /dev/shm/Qwen1.5-32B-Chat ] && \
    time cp -r /home/ma-user/work/hub/hub/Qwen/Qwen1.5-32B-Chat /dev/shm/